{Common::js('layer2.0/layer.js')}

<div class="collect-item {if Controller_Collect::is_exist(array('type_id'=>$typeid,'id'=>$info['id']))}on{/if}" id="collectThis"><i class="icon"></i>收藏</div>
<script>
$('#collectThis').click(function(){
    //未登录.跳转 
    {if !Model_Member::check_login()}
         window.location.href="{$cmsurl}member/login?redirecturl="+encodeURIComponent(window.location.href);
         return true; 
    {/if}
    var add;
    var node=$(this);
    var data={type_id:'{$typeid}',id:'{$info["id"]}'}
    $.post('{$cmsurl}collect/modify',data,function(rs){
        if(node.hasClass('on')){
            add=false;
            node.removeClass('on');
        }else{
            add=true;
            node.addClass('on');
        }
        layer.msg(add?'收藏成功':'取消收藏', {time: 1000});

    },'json');
});

</script>